/* TailwindCSS 已集成，移除冗余样式 */

/* 自定义样式 */

/* 下拉刷新相关样式 */
.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}
:root {
    --task-border: rgba(226, 232, 240, 0.8);
    --task-border-hover: rgba(37, 99, 235, 0.2);
    --delete-hover: rgba(239, 68, 68, 0.1);
    --task-content-color: #1e293b;
    --header-text-color: #1a202c;
}

.dark {
    --task-content-color: #e2e8f0;
    --header-text-color: #f7fafc;
}

h1 {
    color: var(--header-text-color);
}

.task-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border: 1px solid var(--task-border);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.task-item:hover {
    border-color: var(--task-border-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dark .task-item:hover {
    border-color: transparent;
    box-shadow: none;
}

.task-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    border: 2px solid #cbd5e1;
    margin-right: 1rem;
    transition: all 0.2s ease;
}

.task-checkbox:checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

.task-content {
    flex: 1;
    font-size: 0.875rem;
    color: var(--task-content-color);
    margin-right: 1rem;
}

.task-item.completed .task-content {
    color: #94a3b8;
}

.task-tags {
    display: flex;
    gap: 0.5rem;
    margin-right: 1rem;
}

.task-tag {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 1rem;
    background-color: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    white-space: nowrap;
}

.task-delete {
    padding: 0.25rem;
    color: #94a3b8;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.task-delete:hover {
    background-color: var(--delete-hover);
    color: #ef4444;
}

/* PWA 响应式样式 */
@media (display-mode: standalone) {
    /* PWA 状态栏样式 */
    @supports (padding-top: env(safe-area-inset-top)) {
        .safe-top {
            padding-top: env(safe-area-inset-top);
        }
        .safe-bottom {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}

/* 侧边栏基础样式 */
#sidebar {
    width: 256px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, width;
}

/* 桌面端折叠样式 */
@media (min-width: 1024px) {
    #sidebar.collapsed {
        width: 64px;
    }

    #sidebar.collapsed .sidebar-full {
        display: none;
    }

    #sidebar.collapsed #user-profile {
        justify-content: center;
    }

    #sidebar.collapsed .sidebar-collapse-icon {
        transform: rotate(180deg);
    }
    
    /* 折叠时隐藏除头像外的所有内容 */
    #sidebar.collapsed .flex-1,
    #sidebar.collapsed .border-t {
        display: none;
    }

    /* 调整头像区域样式 */
    #sidebar.collapsed .p-4.border-b {
        padding: 0.75rem;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* 确保头像容器正确显示 */
    #sidebar.collapsed #user-profile {
        width: auto;
        margin: 0;
    }

    /* 移除头像容器的间距 */
    #sidebar.collapsed #user-profile > div {
        margin: 0;
    }

    /* 调整折叠按钮位置 */
    #sidebar.collapsed #sidebar-collapse-btn {
        right: -0.75rem;
    }

    /* 调整在线状态指示器位置 */
    #sidebar.collapsed .absolute.-bottom-1 {
        bottom: -0.125rem;
    }
    #sidebar.collapsed .absolute.-right-1 {
        right: -0.125rem;
    }
}

/* 侧边栏样式 */
#sidebar {
    width: 256px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, width;
    overscroll-behavior: contain;
    touch-action: none;
}

/* 桌面端折叠样式 */
@media (min-width: 1024px) {
    #sidebar.collapsed {
        width: 60px;
    }

    #sidebar.collapsed .sidebar-full {
        display: none;
    }

    #sidebar.collapsed #tag-list {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #sidebar.collapsed #sidebar-collapse-icon {
        transform: rotate(180deg);
    }
}

/* 移动端样式 */
@media (max-width: 1023px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.active {
        transform: translateX(0) !important;
    }
}

/* 搜索栏样式 */
#mobile-search {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 标签自动完成样式 */
#tag-autocomplete-container,
#mobile-tag-autocomplete-container {
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
}

.tag-autocomplete-wrapper {
    padding: 0.75rem;
}

.tag-autocomplete-title {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.tag-autocomplete-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}

.tag-autocomplete-item {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid var(--task-border);
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tag-autocomplete-item:hover,
.tag-autocomplete-item.active {
    background-color: rgba(37, 99, 235, 0.1);
}

#mobile-search.active {
    max-height: 60px;
    padding: 0.75rem 1rem;
}

/* 遮罩层样式 */
.sidebar-overlay {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    will-change: opacity;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 底部导航栏 */
.bottom-nav {
    background-color: var(--surface);
    border-top: 1px solid var(--border);
}

/* 新的任务项布局样式 */
.task-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-tags-date-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.task-tags-wrapper {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.task-date {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.task-action-btn {
    padding: 0.25rem;
    color: #94a3b8;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #64748b;
}

.task-action-btn svg {
    width: 1rem;
    height: 1rem;
}

/* 任务菜单样式 */
.task-menu {
    position: absolute;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 120px;
}

.task-menu-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.875rem;
}

.task-menu-item:hover {
    background-color: #f8fafc;
}

.task-menu-item:first-child {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.task-menu-item:last-child {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

.task-menu-item.delete {
    color: #ef4444;
}

.task-menu-item.delete:hover {
    background-color: #fef2f2;
}

/* 评论模态框样式 */
.comment-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.comment-modal-content {
    background: white;
    border-radius: 0.75rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.comment-modal-header {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.comment-modal-footer {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.comment-item {
    background-color: #f8fafc;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
}

.comment-content {
    font-size: 0.875rem;
    color: #1e293b;
    line-height: 1.4;
}

/* 置顶任务样式 */
.task-item.pinned {
    border-color: #fbbf24;
    background-color: #fffbeb;
}

.task-item.pinned::before {
    content: '📌';
    margin-right: 0.5rem;
    font-size: 0.75rem;
}

@supports (height: 100dvh) {
    .h-screen { height: 100dvh; }
    .min-h-screen { min-height: 100dvh; }
}
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
/* Tags 折叠/展开动画与滚动条样式 */
.collapsible {
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
    overflow: hidden;
}
.collapsible.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
    border: none;
}

/* 滚动条样式（与主题色一致） */
.tag-scroll {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}
.dark .tag-scroll {
    scrollbar-color: #334155 #0f172a;
}
.tag-scroll::-webkit-scrollbar { width: 8px; }
.tag-scroll::-webkit-scrollbar-track { background: rgba(226, 232, 240, 0.6); border-radius: 8px; }
.tag-scroll::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.8); border-radius: 8px; }
.dark .tag-scroll::-webkit-scrollbar-track { background: #1e293b; }
.dark .tag-scroll::-webkit-scrollbar-thumb { background: #334155; }
